package com.sxhuayuan.parking.plugin.invoice.nuonuo.request;

import com.sxhuayuan.parking.plugin.invoice.nuonuo.DESDZFP;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;

import java.util.HashMap;
import java.util.Map;

/**
 * 查询开票开具情况
 * @author helong
 * @create 2019/9/3 11:32
 */
@Getter
@Setter
@Slf4j
public class QueryInvoiceRequest {
	private String identity;
	private String orderno;

	public QueryInvoiceRequest(String identity, String orderno) {
		this.identity = identity;
		this.orderno = orderno;
	}
	public String getEncryptionParameter(){
		Assert.notNull(this.identity,"identity不能为空");
		Assert.notNull(this.orderno,"orderno不能为空");
		String json = "{\"identity\":\""+this.identity+"\",\"orderno\":[\""+this.orderno+"\"]}";
		log.debug("【{}】查询开票参数：{}",orderno,json);
		return DESDZFP.encrypt(json);
	}

	public Map<String,Object> getMapParameter(){
		Map<String,Object> map = new HashMap<>(1);
		map.put("order",getEncryptionParameter());
		return map;
	}
}
